﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace SecurityAgent
{
    [DataContract] 
    public class ObjectClaim
    {
        [DataMember]
        public Guid ObjectKey { get; set; }
        
        [DataMember]
        public string ObjectName { get; set; }

        [DataMember]
        public string ObjectCategory { get; set; }

        [DataMember]
        public string FieldLevelSecurityEnabled { get; set; }

        [DataMember]
        public AccessLevel ObjectAccess { get; set; }

        [DataMember]
        public FieldClaimCollection Fields { get; set; }
    }

    [DataContract]
    public class FieldClaim
    {
        [DataMember]
        public Guid FieldKey { get; set; }

        [DataMember]
        public string FieldName { get; set; }

        [DataMember]
        public Guid ObjectKey { get; set; }

        [DataMember]
        public string ObjectName { get; set; }

        [DataMember]
        public string FieldDataType { get; set; }

        [DataMember]
        public AccessLevel FieldAccess { get; set; }
    }

    [CollectionDataContract]
    public class FieldClaimCollection : List<FieldClaim> { }

    [DataContract]
    public class AccessLevel
    {
        [DataMember]
        public Guid ObjectKey { get; set; }
        
        [DataMember]
        public bool AllowRead { get; set; }
        
        [DataMember]
        public bool AllowCreate { get; set; }
        
        [DataMember]
        public bool AllowUpdate { get; set; }
        
        [DataMember]
        public bool AllowDelete { get; set; }
    }

    

    

    [DataContract] 
    public class SecurityPrincipal
    {
        [DataMember]
        public string Comment { get; set; }

        [DataMember]
        public DateTime CreationDate { get; set; }

        [DataMember]
        public string Email { get; set; }

        [DataMember]
        private bool isApproved { get; set; }

        [DataMember]
        public bool IsApproved { get; set; }

        [DataMember]
        public bool IsLockedOut { get; set; }

        [DataMember]
        public bool IsOnline { get; set; }
        
        [DataMember]
        public DateTime LastActivityDate { get; set; }

        [DataMember]
        public DateTime LastLockoutDate { get; set; }

        [DataMember]
        public DateTime LastLoginDate { get; set; }

        [DataMember]
        public DateTime LastPasswordChangedDate { get; set; }

        [DataMember]
        public string PasswordQuestion { get; set; }

        [DataMember]
        public object ProviderUserKey { get; set; }

        [DataMember]
        public object SecurityAgentToken { get; set; }

        [DataMember]
        public string UserName { get; set; }

        [DataMember]
        public string[] Roles { get; set; }
    }

    [CollectionDataContract]
    public class SecurityPrincipalCollection : List<SecurityPrincipal>
    {
    }

    [CollectionDataContract]
    public class RoleCollection : List<string> { }

    [DataContract]
    public class ProfilePropertyValue
    {
        [DataMember]
        public string PropertyName { get; set; }
        
        [DataMember]
        public string PropertyValue { get; set; }
    }

    [CollectionDataContract]
    public class ProfilePropertyValueCollection : List<ProfilePropertyValue> { }

    [DataContract]
    public class ProfileInfo
    {
        [DataMember]
        public string UserName { get; set; }

        [DataMember]
        public string ApplicationKey { get; set; }

        [DataMember]
        public ProfilePropertyValueCollection Properties { get; set; }
    }
}
